package com.sinothk.webrtc.demo;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.dds.webrtclib.bean.MeetingMsg;
import com.dds.webrtclib.bean.RoomInfoEntity;
import com.dds.webrtclib.inters.OnBizEventListener;
import com.sinothk.webrtc.android.RtcHelper;

import java.util.ArrayList;

public class RoomListDemoActivity extends AppCompatActivity implements OnBizEventListener {

    RtcHelper rtcHelper;

    public static void openActivity(Activity currActivity) {
        Intent intent = new Intent(currActivity, RoomListDemoActivity.class);
        currActivity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_room_list_demo);

        if (!RtcHelper.getInstance().isConnect()) {
            // 未连接
            RtcApp.initRtc();
        }

        rtcHelper = RtcHelper.getInstance();
        rtcHelper.setBizEventListener(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        if (rtcHelper != null) {
            rtcHelper.close();
        }
    }

    @Override
    public void onEnterOrExitRoom(MeetingMsg meetingMsg) {
        if (meetingMsg == null) {
            
        }
    }

    @Override
    public void onRoomListChange(ArrayList<RoomInfoEntity> roomList) {
        if (roomList == null) {
            
        }
    }
}
